<?php
/*
# ------------------------------------------------------------------------
# JD Base Theme
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
//load layout content and store in t3_layouts variable (javascript)
$layout_js = drupal_to_js($layouts);

$layout_js = 'var t3_layouts = '.$layout_js .";\n";

drupal_add_js($layout_js, 'inline');
$form[] = array(
	'#value'=>'<div id="theme-layouts">'
);

$html = '';

if(!$_COOKIE['theme-layouts-t3-help']){
	$help_style = "style=\"display:block\"";
}else{
	$help_style = "style=\"display:none\"";
}

$html .= '<div id="theme-layouts-t3-help" class="ja-inner-help" '.$help_style.'>';


$html .= '<a title="'.t('Hide').'" class="ja-help-close" href="javascript:void(0)" onclick="t3_close_help(this, true)">'.t('Close').'</a>';
$html .= t('<strong>What is this panel for?</strong><br />In this administration panel you can manage layouts used by the Drupal theme. Using the internal editor you can easily create / customize layouts. <br /><br /><strong>What is a layout?</strong><br />A layout is a file to load a set of other files called blocks and controls the general design of the template. Each layout can load different blocks with default or custom width settings. Blocks hold the several module positions a T3 Framework based template have, and having similar blocks but with different style classes help to create distinctive layouts.<br /><br /><strong>What does this button do?</strong><br />Here you can create <em style="color:green">new</em> layouts, <em style="color:blue">edit</em> / <em style="color:green">clone</em> the core layouts and you can also <em style="color:blue">rename</em> or <em style="color:red">delete</em> the layouts you create, but you cannot delete the core layouts and their blocks as they are used as samples for your custom layouts. You can do all these in this very page, no need to use code editors. <br /><br /><a target="_blank" href="http://wiki.joomlart.com/wiki/JD_T3_Framework/Guides#Layouts_Panel">Click here</a> to learn all about layouts management.');
$html .= '</div>';


$form[] = array(
	'#value'=>$html
);

$html = '';
$html .= '  <table class="jd-table-layout jd-admintable">
			 <thead>
  			 <th class="item-number">'.t('#').'</th>	
  			 <th>'.t('Name').'</th>	
  			 <th>'.t('Action').'</th>	
			 </thead>';
if(count($layouts)){
	$i = 1;
	foreach ($layouts as $name=>$layout_info){
		$html .= '<tr>';
		$html .= '<td class="jd-layout-num">'.$i.'</td>';
		$html .= '<td>'.t($name).'</td>';
		$html .= '<td><span onclick="t3_edit_layout(\''.$name.'\')" class="jd-edit">'.t('Edit').'</span>';
		$html .= '<span onclick="t3_layout_clone(\''.$name.'\')" class="jd-clone">'.t('Clone').'</span>';
		switch ($layout_info['type']) {
			case 'core':
				$html .= '<span class="layout-type">'.t('Core').'</span>';
				break;
			case 'local':
				$html .= '<span onclick="t3_layout_delete(\''.$name.'\', this)" class="jd-delete">'.t('Delete').'</span>';
				$html .= '<span class="layout-type">'.t('User Added').'</span>';
				break;
			case 'override':
				$html .= '<span onclick="t3_layout_reset(\''.$name.'\', this)" class="jd-reset">'.t('Reset').'</span>';
				$html .= '<span class="layout-type">'.t('Modified').'</span>';
				break;
		}
		$html .= '</td>';
		$html .= '</tr>';
		$i++;
	}
}else{
	$html .= '<tr>';
	$html .= '<td colspan="3">'.t('There is no layout.').'</td>';
	$html .= '</tr>';
}
			 
$html	.=	 '</table>';
$html .= '<div class="jd-layout-new" onclick="t3_new_layout();">
				<span class="jd-new">'.t('New').'</span>
				</div>';

$form[] = array(
	'#value'=>$html
);
$form[] = array(
	'#value'=>'</div>'
);